Release 10.1A: OpenEdge Development:
Progress 4GL Reference
BUFFER-COMPARE statement
Performs a bulk comparison of two records (source and target) by comparing source and target fields of the same name for equality and storing the result in a field. You can specify a list of fields to exclude, or a list of fields to include. You can also specify WHEN...THEN phrases. For all such phrases you specify, Progress evaluates the WHEN portion, and if it evaluates to TRUE, Progress executes the THEN portion.
Syntax
sourceThe source database table, buffer, temporary table, or work table.
EXCEPTfieldA list of source fields to exclude from the bulk compare.
USINGfieldA list of source fields to include in the bulk compare. The USING option is a positive version of the EXCEPT option.
TOtargetThe target database table, buffer, temporary table, or work table.
CASE-SENSITIVEDirects Progress to perform a case-sensitive comparison.
BINARYDirects Progress to perform a binary comparison.
SAVE RESULT INresult-fieldA variable or field to contain the result of the comparison. The variable or field must be CHARACTER or LOGICAL.
If
result-fieldis CHARACTER, the result is a comma-separated list of fields that failed the comparison, sorted in ascending order.If
result-fieldis LOGICAL, the result is YES if all fields are equal, or NO if any fields are unequal. In either case, BUFFER-COMPARE stops comparing when it encounters the first inequality.EXPLICIT COMPARESOpens a block of WHEN options. If you open the block, you must close it with END COMPARES.
WHENfieldAny data field in the source.
BUFFER-COMPARE removes this field from a USING list or adds this field to an EXCEPT list. This removes the field from the bulk compare and from result-field.
compare-operatorRepresents one of the following: LT, LE, GT, GE, EQ, NE, MATCHES, BEGINS, or CONTAINS.
expressionAny valid Progress expression.
THENstatement-or-blockAny Progress statement or block. The statement or block executes when the WHEN clause evaluates to TRUE.
END COMPARESCloses the block of WHEN phrases.
NO-LOBSDirects Progress to ignore large object data when comparing records that contain BLOB or CLOB fields.
NO-ERRORDiverts any error messages from this statement to the ERROR-STATUS system handle and records the success of this statement in ERROR-STATUS:ERROR.
Notes
- At compile time, BUFFER-COMPARE:
- Fails to compile if any source-target field pair is not type compatible. An example of such a pair is a field that is LOGICAL in the source, but DECIMAL in the target.
- Excludes from the bulk comparison all EXCEPT
fieldfields and all WHENfieldfields.- Automatically excludes from the bulk comparison fields that appear in the source but not in the target.
- Tries to bind unqualified field names that appear in the EXCEPT and USING options to the source buffer.
- At run time, BUFFER-COMPARE:
- Compares all fields not in the EXCEPT phrase and all fields not in the WHEN phrase for equality.
- Stores the result in the field that the SAVE phrase specifies, if any.
Note: This behavior is different from the behavior of the Progress 4GL CASE statement, which executes only the first WHEN option whose condition evaluates to TRUE.- Evaluates each WHEN option, executing it if its condition evaluates to TRUE.
- When comparing records that contain BLOB fields, Progress performs a binary comparison on the BLOB data associated with the source and target records, and reports the results of the comparison.
- You cannot use the BUFFER-COMPARE statement to compare records that contain CLOB fields, unless one or both of the corresponding fields contain the Unknown value (
?). However, you can convert CLOB fields to LONGCHAR values and use the EQ, GE, GT, LE, LT, or NE comparison operator to compare the LONGCHAR values.- Use the
NO-LOBSoption with the BUFFER-COMPARE statement to ignore large object data when comparing records that contain BLOB or CLOB fields. You can also use theEXCEPToption to exclude BLOB and CLOB fields from the compare.See also
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |